package com.ckf.ckfmall.orders.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ckf.ckfmall.api.service.GoodsService;
import com.ckf.ckfmall.api.service.OrdersService;
import org.springframework.stereotype.Service;
import com.ckf.ckfmall.api.entity.UserAddress;
import com.ckf.ckfmall.api.service.UserService;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 安详的苦丁茶
 * @date 2020/6/5 8:43
 */

@Service
public class OrdersServiceImpl implements OrdersService {


    @Reference(check = false)      //注意：这里是调用服务提供者项目中的userService对象  （远程过程调用  RPC）
    UserService userService;

    @Reference(check = false)
    GoodsService goodsService;

    @Override
    public Map<String, Object> initOrder(String userId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("user", userService.getUserAddressList(userId));
        map.put("goods", goodsService.goodsList());
        return map;
    }
}
